package com.qq.mall.controller;

import com.qq.mall.beans.Admin;
import com.qq.mall.service.AdminService;
import com.qq.mall.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/retaildemo/admin")
@Api(tags = "商家管理")
public class AdminController {

    @Resource
    private AdminService adminService;

    @GetMapping("/one/{id}")
    @ApiOperation("通过ID查询商家信息")
    public Admin select(@PathVariable("id") String id){
        return this.adminService.findByName(id);
    }

    @GetMapping("/login")
    public ResultVO login(@RequestParam("adminname") String name,
                          @RequestParam(value = "adminpwd") String pwd){

        System.out.println(adminService.checkLogin(name, pwd));
        return adminService.checkLogin(name, pwd);

    }
}
